/**
 * @addtogroup brd_reset_def
 * brd_reset_def
 * @{
 */
/**
 * @file brd_reset_def.h
 * @brief 芯片复位板级层定义
 * @note
 * @par 修改日志
 * <table>
 * <tr><th>Date <th>Version <th>Author <th>Description
 * <tr><td>2023-08-18 <td>1.0 <td>软件工程院 <td>创建初始版本
 * @copyright 杭州鸿泉物联网技术股份有限公司
 */
#ifndef _BRD_RESET_DEF_H_
#define _BRD_RESET_DEF_H_

#ifdef __cplusplus
extern "C" {
#endif

/**
 * 复位源
 * 
 */
enum Brd_TResetSourceTag
{
    kBrd_ResetSourceBase                        = 0,
    kBrd_ResetSourceDest                        = kBrd_ResetSourceBase,     ///< 破坏复位
    kBrd_ResetSourceFunc                        = 1,                        ///< 功能复位
    kBrd_ResetSourceStandby                     = 2,                        ///< 待机时, 发生破坏复位或者功能复位
    kBrd_ResetSourceWakeup                      = 3,                        ///< 待机时, 发送了唤醒事件
    kBrd_ResetSourceMax,
};
typedef enum Brd_TResetSourceTag Brd_TResetSource;

#define BRD_RESET_SOURCE_DEST
#define BRD_RESET_SOURCE_FUNC
#define BRD_RESET_SOURCE_STANDBY
#define BRD_RESET_SOURCE_WAKEUP

/**
 * 破坏复位原因
 * 
 */
enum Brd_TResetDestReasonTag
{
    kBrd_ResetDestReasonDebug                    = 1U << 30,     ///< 调试破坏性复位
    kBrd_ResetDestReasonSw                       = 1U << 29,     ///< 软件破坏性复位
    kBrd_ResetDestReasonHseSnvsRst               = 1U << 18,     ///< HSE_B SNVS篡改检测破坏性复位
    kBrd_ResetDestReasonHseTmprRst               = 1U << 17,     ///< HSE_B 篡改检测破坏性复位
    kBrd_ResetDestReasonCm7CoreClkFail           = 1U << 16,     ///< CM7_CORE_CLK时钟失败破坏性复位
    kBrd_ResetDestReasonSysDivFail               = 1U << 15,     ///< 系统时钟分压器对准失败破坏性复位
    kBrd_ResetDestReasonHseClkFail               = 1U << 14,     ///< HSE_CLK时钟失败破坏性复位
    kBrd_ResetDestReasonAipsPlatClkFail          = 1U << 12,     ///< AIPS_PLAT_CLK时钟失败破坏性复位
    kBrd_ResetDestReasonCoreClkFail              = 1U << 10,     ///< Core时钟失败破坏性复位
    kBrd_ResetDestReasonPllLol                   = 1U << 9,      ///< PLL丢失锁破坏性复位
    kBrd_ResetDestReasonFxoscFail                = 1U << 8,      ///< FXOSC失败破坏性复位
    kBrd_ResetDestReasonMcRgmFre                 = 1U << 6,      ///< 功能性复位升级破坏性复位
    kBrd_ResetDestReasonStcuUrf                  = 1U << 4,      ///< STCU2不可恢复故障破坏性复位
    kBrd_ResetDestReasonFccuFtr                  = 1U << 3,      ///< FCCU没有反映破坏性复位
    kBrd_ResetDestReasonPor                      = 1U << 0,      ///< 上电复位标志, 当标志置位时, 忽略TBrd_ResetDestReason和TBrd_ResetFuncReason的其他原因
};
typedef enum Brd_TResetDestReasonTag Brd_TResetDestReason;

#define BRD_RESET_DEST_REASON_DEBUG
#define BRD_RESET_DEST_REASON_SW
#define BRD_RESET_DEST_REASON_HSE_SNVS_RST
#define BRD_RESET_DEST_REASON_HSE_TMPR_RST
#define BRD_RESET_DEST_REASON_CM7_CORE_CLK_FAIL
#define BRD_RESET_DEST_REASON_SYS_DIV_FAIL
#define BRD_RESET_DEST_REASON_HSE_CLK_FAIL
#define BRD_RESET_DEST_REASON_AIPS_PLAT_CLK_FAIL
#define BRD_RESET_DEST_REASON_CORE_CLK_FAIL
#define BRD_RESET_DEST_REASON_PLL_LOL
#define BRD_RESET_DEST_REASON_FXOSC_FAIL
#define BRD_RESET_DEST_REASON_MC_RGM_FRE
#define BRD_RESET_DEST_REASON_STCU_URF
#define BRD_RESET_DEST_REASON_FCCU_FTR
#define BRD_RESET_DEST_REASON_POR

/**
 * 功能复位原因
 * 
 */
enum Brd_TResetFuncReasonTag
{
    kBrd_ResetFuncReasonDebug                    = 1U << 30,     ///< 调试功能性复位
    kBrd_ResetFuncReasonSw                       = 1U << 29,     ///< 软件功能性复位
    kBrd_ResetFuncReasonHseBootRst               = 1U << 20,     ///< HSE_B boot功能性复位
    kBrd_ResetFuncReasonHseSwtRst                = 1U << 16,     ///< HSE_B SWT超时功能新复位
    kBrd_ResetFuncReasonPllAux                   = 1U << 12,     ///< PLL复位请求功能性复位
    kBrd_ResetFuncReasonSwt3Rst                  = 1U << 10,     ///< SWT3复位请求功能性复位
    kBrd_ResetFuncReasonJtagRst                  = 1U << 9,      ///< JTAG复位功能性复位
    kBrd_ResetFuncReasonSwt2Rst                  = 1U << 8,      ///< SWT2复位请求功能性复位
    kBrd_ResetFuncReasonSwt1Rst                  = 1U << 7,      ///< SWT1复位请求功能性复位
    kBrd_ResetFuncReasonSwt0Rst                  = 1U << 6,      ///< SWT0复位请求功能性复位
    kBrd_ResetFuncReasonStDone                   = 1U << 4,      ///< 自测完成功能性复位
    kBrd_ResetFuncReasonFccuRst                  = 1U << 3,      ///< FCCU 复位连接功能性复位
    kBrd_ResetFuncReasonExr                      = 1U << 0,      ///< 外部复位, 实际属于TBrd_ResetDestReason的一种
};
typedef enum Brd_TResetFuncReasonTag Brd_TResetFuncReason;

#define BRD_RESET_FUNC_REASON_DEBUG
#define BRD_RESET_FUNC_REASON_SW
#define BRD_RESET_FUNC_REASON_BOOT_RST
#define BRD_RESET_FUNC_REASON_SWT_RST
#define BRD_RESET_FUNC_REASON_PLL_AUX
#define BRD_RESET_FUNC_REASON_SWT3_RST
#define BRD_RESET_FUNC_REASON_JTAG_RST
#define BRD_RESET_FUNC_REASON_SWT2_RST
#define BRD_RESET_FUNC_REASON_SWT1_RST
#define BRD_RESET_FUNC_REASON_SWT0_RST
#define BRD_RESET_FUNC_REASON_ST_DONE
#define BRD_RESET_FUNC_REASON_FCCU_RST
#define BRD_RESET_FUNC_REASON_EXR

/**
 * 待机时,发生破坏复位或者功能复位的原因
 * 
 */
enum Brd_TResetStandbyReasonTag
{
    kBrd_ResetStandbyReasonFunc                  = 1U << 1,      ///< 待机时发生功能复位, 然后检查TBrd_ResetFuncReason
    kBrd_ResetStandbyReasonDest                  = 1U << 0,      ///< 待机时发生破坏复位, 然后检查TBrd_ResetDestReason
};
typedef enum Brd_TResetStandbyReasonTag Brd_TResetStandbyReason;

#define BRD_RESET_STANDBY_REASON_FUNC
#define BRD_RESET_STANDBY_REASON_DEST

/**
 * 待机时，发送了唤醒事件的唤醒源
 */
enum Brd_TResetWakeupReasonTag {
    kBrd_ResetWakeupReasonNone                  = 0,            ///< 未发生唤醒事件
    kBrd_ResetWakeupReasonAcc                   = 1,            ///< 钥匙电(T30)唤醒
    kBrd_ResetWakeupReasonAccWake               = 2,            ///< 备用钥匙电(T30)唤醒
    kBrd_ResetWakeupReasonIg                    = 3,            ///< Ig(T15)点火唤醒
    kBrd_ResetWakeupReasonNetWakeupMcu          = 4,            ///< 网络模块唤醒MCU唤醒
    kBrd_ResetWakeupReasonNetStatus             = 5,            ///< 网络模块状态唤醒
    kBrd_ResetWakeupReasonNetSleep              = 6,            ///< 网络模块休眠唤醒
    kBrd_ResetWakeupReasonAxis                  = 7,            ///< 轴传感器唤醒
    kBrd_ResetWakeupReasonExtRtc                = 8,            ///< 外部RTC唤醒
    kBrd_ResetWakeupReasonChgHigh               = 9,            ///< 充电高唤醒
    kBrd_ResetWakeupReasonChgLow                = 10,           ///< 充电低唤醒
    kBrd_ResetWakeupReasonPwrLost               = 11,           ///< 主电掉电唤醒
    kBrd_ResetWakeupReasonCan0                  = 12,           ///< 第一路CAN唤醒
    kBrd_ResetWakeupReasonCan1                  = 13,           ///< 第二路CAN唤醒
    kBrd_ResetWakeupReasonCan2                  = 14,           ///< 第三路CAN唤醒
    kBrd_ResetWakeupReasonCan3                  = 15,           ///< 第四路CAN唤醒
    kBrd_ResetWakeupReasonBthInt                = 16,           ///< 蓝牙唤醒
    kBrd_ResetWakeupReasonSw1                   = 17,           ///< 第一路外部开关量唤醒
};
typedef enum Brd_TResetWakeupReasonTag Brd_TResetWakeupReason;

#define BRD_RESET_WAKEUP_REASON_NONE
#define BRD_RESET_WAKEUP_REASON_ACC
#define BRD_RESET_WAKEUP_REASON_ACC_WAKE
#define BRD_RESET_WAKEUP_REASON_IG
#define BRD_RESET_WAKEUP_REASON_NET_WAKEUP_MCU
#define BRD_RESET_WAKEUP_REASON_NET_STATUS
#define BRD_RESET_WAKEUP_REASON_NET_SLEEP
#define BRD_RESET_WAKEUP_REASON_AXIS
#define BRD_RESET_WAKEUP_REASON_EXT_RTC
#define BRD_RESET_WAKEUP_REASON_CHG_HIGH
#define BRD_RESET_WAKEUP_REASON_CHG_LOW
#define BRD_RESET_WAKEUP_REASON_PWR_LOST
#define BRD_RESET_WAKEUP_REASON_CAN0
#define BRD_RESET_WAKEUP_REASON_CAN1
#define BRD_RESET_WAKEUP_REASON_CAN2
#define BRD_RESET_WAKEUP_REASON_CAN3
#define BRD_RESET_WAKEUP_REASON_BTH_INT
#define BRD_RESET_WAKEUP_REASON_SW1

#ifdef __cplusplus
}  ///  < extern "C"
#endif

#endif // _BRD_RESET_DEF_H_
/**
 * @} 
 */
